package com.zzyl.nursing.service.impl;
/*
 *TODO
 *@Autor Adam
 *@Date  2025/7/31  19:53
 *
 */


import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzyl.nursing.dto.ProjectPageDto;
import com.zzyl.nursing.service.OrdersService;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.mapper.NursingProjectMapper;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class OrdersServiceImpl extends ServiceImpl<NursingProjectMapper,NursingProject> implements OrdersService{
    /**
     * 分页查询护理项目列表
     * @param dto
     * @return
     */
    @Override
    public List<NursingProject> selectByDto(ProjectPageDto dto) {
        LambdaQueryWrapper<NursingProject> queryWrapper = Wrappers.<NursingProject>lambdaQuery();
        if(!ObjectUtil.isEmpty(dto.getStatus())){
            queryWrapper.eq(NursingProject::getStatus, dto.getStatus());
        }
        if(!ObjectUtil.isEmpty(dto.getName())){
            queryWrapper.eq(NursingProject::getName, dto.getName());
        }
        List<NursingProject> projectList = this.list(queryWrapper);
        return projectList;
    }

    /**
     * 根据编号查询护理项目信息
     * @param id
     * @return
     */
    @Override
    public NursingProject selectById(Long id) {
        return this.getOne(Wrappers.<NursingProject>lambdaQuery().eq(NursingProject::getId, id));
    }


}
